//enum定义枚举 枚举类型
const enum Direction {
  up,
  down,
  left,
  right,
}

console.log(Direction.up); //{ '0': 'up', '1': 'down', '2': 'left', '3': 'right', up: 0, down: 1, left: 2, right: 3 }
// let dir: Direction = Direction.up;
// console.log(dir); //结果：shang
// function walk(data: Direction) {
//   if (data === Direction.up) {
//     console.log("向上走");
//   } else if (data === Direction.down) {
//     console.log("向下走");
//   } else if (data === Direction.left) {
//     console.log("向左走");
//   } else if (data === Direction.right) {
//     console.log("向右走");
//   } else {
//     console.log("未知方向");
//   }
// }
// walk(Direction.right); // console.log("向右走");
